package clientGUI.userPanels;

import clientGUI.userPanels.Controllers.SupervisorController;
import clientserver.Client;
import college.Date;
import college.User;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class SupervisorEvaluationTimelimit extends UPanel {

	Date date;
	SupervisorController controller;
	User currentUser;
	private JTextField textField;
	private JTextField textField_1;
	
	public SupervisorEvaluationTimelimit(int rid, Client cl) {
		setLayout(null);
		
		controller = new SupervisorController(cl,rid);
		
		
		JLabel lblEvaluationTimelimitApproval = new JLabel("EVALUATION TIMELIMIT APPROVAL");
		lblEvaluationTimelimitApproval.setBounds(154, 23, 207, 14);
		add(lblEvaluationTimelimitApproval);
		
		JLabel lblProposedEndingDate = new JLabel("Proposed Ending Date");
		lblProposedEndingDate.setBounds(32, 87, 146, 14);
		add(lblProposedEndingDate);
		
		
		textField = new JTextField(controller.getCurrentEndDate().toString());
		textField.setBounds(242, 84, 146, 20);
		add(textField);
		textField.setColumns(10);
		
		JLabel lblCurrentStartingDate = new JLabel("Current Starting Date");
		lblCurrentStartingDate.setBounds(36, 137, 122, 14);
		add(lblCurrentStartingDate);
		
		textField_1 = new JTextField(controller.getCurrentStartDate().toString());
		textField_1.setBounds(242, 134, 146, 20);
		add(textField_1);
		textField_1.setColumns(10);
		
		JButton btnApprove = new JButton("Approve");
		btnApprove.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				controller.approvedEvaluationTimelimit();
				myframe.SetMainUserPanel();
			}
		});
		btnApprove.setBounds(47, 246, 91, 23);
		add(btnApprove);
		
		JButton btnDisapprove = new JButton("Disapprove");
		btnDisapprove.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				controller.disapproveEvaluationTimelimit();
				myframe.SetMainUserPanel();
			}
		});
		btnDisapprove.setBounds(347, 246, 112, 23);
		add(btnDisapprove);
		
		JButton btnMainMenu = new JButton("Main Menu");
		btnMainMenu.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e)
			{
				myframe.SetMainUserPanel();
			}
		});
		btnMainMenu.setBounds(197, 246, 89, 23);
		add(btnMainMenu);
	}
	
	
}
